package com.freesky.biz.abchina.controller;

import com.freesky.biz.abchina.domain.TCreditRecord;
import com.freesky.biz.abchina.domain.TCreditRecordNew;
import com.freesky.biz.abchina.domain.TRightsOrderRecord;
import com.freesky.biz.abchina.service.ICreditRecordService;
import com.freesky.biz.abchina.service.IRightsOrderService;
import com.freesky.common.annotation.Log;
import com.freesky.common.core.controller.BaseController;
import com.freesky.common.core.domain.AjaxResult;
import com.freesky.common.core.page.TableDataInfo;
import com.freesky.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 福建农行信用卡微信首绑首刷礼
 */
@RestController
@RequestMapping("/abchina/rights/order")
public class RightsOrderController extends BaseController {

    @Autowired
    private IRightsOrderService rightsOrderService;

    /**
     * 信用卡权益列表
     */
    @PreAuthorize("@ss.hasPermi('abchina:rightsorder:list')")
    @GetMapping("/list")
    public TableDataInfo list(TRightsOrderRecord orderRecord) {
        startPage();
        List<TRightsOrderRecord> list = rightsOrderService.findList(orderRecord);
        return getDataTable(list);
    }

    @Log(title = "信用卡首绑", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('abchina:rightsorder:export')")
    @GetMapping("/export")
    public AjaxResult export(TRightsOrderRecord orderRecord,
                             HttpServletResponse response) {
        return rightsOrderService.exportFile(orderRecord);
    }
}
